﻿using System;
using System.Windows.Forms;
using WiMo.Games;
using WiMo.Games.WM5;


namespace YABOG
{
    static class Program
    {
        [MTAThread]
        static void Main()
        {
            var gameEngine = new WiMo.Games.WM5.GameEngine();
            
            var formSize = new Size(gameEngine.Form.Size.Width, gameEngine.Form.Size.Height);
            var targetSize = new Size(240, 320);

            gameEngine.CollisionManager = new WiMo.Games.StandardCollisions.CollisionManager(targetSize);
            //gameEngine.Display = new WiMo.Games.GDIDisplay.DisplayManager(gameEngine.Form.Handle, targetSize, formSize, WiMo.Games.Display.AspetRatioThreeByFour);
            try
            {
                //gameEngine.Display = new WiMo.Games.DirectDrawDisplay.DisplayManager(gameEngine.Form.Handle, targetSize, formSize, WiMo.Games.Display.AspetRatioThreeByFour);
                gameEngine.Display = new WiMo.Games.Premium.GDIDisplay.DisplayManager(gameEngine.Form.Handle, targetSize, formSize, WiMo.Games.Display.AspetRatioThreeByFour);
                //gameEngine.Display = new WiMo.Games.GapiDrawDisplay.DisplayManager(gameEngine.Form.Handle, targetSize, formSize,  WiMo.Games.Display.AspetRatioThreeByFour);
                gameEngine.InputManager = new WiMo.Games.StandardInput.InputManager(gameEngine.Form, gameEngine);
                gameEngine.AudioManager = new WiMo.Games.StandardAudio.AudioManager(gameEngine);
                gameEngine.PhysicsManager = new WiMo.Games.StandardPhysics.PhysicsManager();
                gameEngine.MenuManager = new WiMo.Games.StandardMenus.MenuManager(gameEngine);
                gameEngine.StateManager = new StateManager(gameEngine);
                var game = new Game(gameEngine);
                gameEngine.Initialize(game);
                gameEngine.Start();
                Application.Run(gameEngine.Form);
            }
            catch (OutOfMemoryException)
            {
                MessageBox.Show("Not enough memory to start tgame.\r\nPlease reset your device and try again.", "Out of Memory",MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
    }
}